package com.ujoku.dao.impl;

import com.labillusion.core.database.base.mybatis.dao.impl.BaseDaoImpl;
import com.ujoku.dao.MemberDao;
import com.ujoku.domain.Member;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 14-10-19.
 */
@Repository
public class MemberDaoImpl extends BaseDaoImpl<Member> implements MemberDao<Member> {


    @Override
    public int addFriend(Map<String, Object> query){

        return sqlSessionTemplate.insert(getSqlName("addFriend"), query);
    }

    @Override
    public int removeFriend(Map<String, Object> query){

        return sqlSessionTemplate.delete(getSqlName("removeFriend"),query);
    }

    @Override
    public List<Member> getMyFriendList(Map<String, Object> query){

        return sqlSessionTemplate.selectList(getSqlName("getMyFriend"), query);
    }

    @Override
    public int getMyFriendCount(Map<String, Object> query){
        return sqlSessionTemplate.selectOne(getSqlName("getMyFriendCount"), query);
    }

    @Override
    public int updateStatus(Member member){
        return sqlSessionTemplate.update(getSqlName("updateStatus"), member);
    }

}
